package ventanaEquipo;



import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import org.jvnet.substance.SubstanceLookAndFeel;
import org.jvnet.substance.watermark.SubstanceBinaryWatermark;
import org.jvnet.substance.watermark.SubstanceCrosshatchWatermark;
import org.jvnet.substance.watermark.SubstanceLatchWatermark;
import org.jvnet.substance.watermark.SubstanceMagneticFieldWatermark;
import org.jvnet.substance.watermark.SubstancePlanktonWatermark;
import org.jvnet.substance.watermark.SubstanceStripeWatermark;



@SuppressWarnings("serial")
public class TablaEquipoTabla extends JPanel {
	private JFrame parent;
	private JScrollPane scrollpane;
	private JTable table;
	private JButton altaB, bajaB,finalizarB;
	private JTextField idT;
	private JLabel idL;
	private TablaEquipoModelo ptm;
	private List< Object > data;  //debugggg   prueba ventana

	public TablaEquipoTabla() {
		initGui();
		layoutComponents();
		addActions();
		showWindow();
	}

	private void initGui() {
		idL = new JLabel("Equipo:");
		idT = new JTextField();
		altaB = new JButton("Agregar jugador");
		bajaB = new JButton("Borrar jugador");
		finalizarB = new JButton("Finalizar");
		parent = new JFrame();
		parent.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// PRUEBA
		data = new ArrayList<Object>();

		
		// END PRUEBA
		
		ptm = new TablaEquipoModelo(data);
		table = new JTable(ptm);
		scrollpane = new JScrollPane(table);
		

	}

	private void layoutComponents() {
		setPreferredSize(new Dimension(400, 400));
		setLayout(null);
		//setBackground(Color.RED);
		// idL.setBorder(BorderFactory.createLineBorder(Color.BLUE));
		idL.setBounds(25, 40, 40, 20);
		this.add(idL);
		idT.setBounds(65, 40, 100, 20);
		this.add(idT);
		scrollpane.setBounds(80, 80, 250, 200);
		this.add(scrollpane);
		altaB.setBounds(20, 300, 100, 20);
		this.add(altaB);
		bajaB.setBounds(150, 300, 100, 20);
		this.add(bajaB);
		finalizarB.setBounds(270, 300, 100, 20);
		this.add(finalizarB);
		
		parent.setBounds(50, 40, 800, 400);
		parent.add(TablaEquipoTabla.this);
		parent.pack();
		parent.setTitle("Work Panel Alta Equipo");
		parent.setLocationRelativeTo(null);
		
		
	}

	private void addActions() {
		/// aca hay q poner los controlessssss
	}

	private void showWindow() {
		parent.setVisible(true);
	}
	
	/*
	 *   Main para probar la ventana el cual llama al skinn
	 */
	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(new SubstanceLookAndFeel());
			 SubstanceLookAndFeel.setCurrentWatermark(new SubstancePlanktonWatermark());
			JFrame.setDefaultLookAndFeelDecorated(true);
			JDialog.setDefaultLookAndFeelDecorated(true);
		} catch (UnsupportedLookAndFeelException ulafe) {
			System.out.println("Substance failed to set");
		}
		TablaEquipoTabla tp = new TablaEquipoTabla();
		tp.showWindow();
	}

	
}